Skip to content

fix: preserve subprocess results with non-UTF-8 output - #1184

Merged
henryiii merged 2 commits into
pypa:mainfrom
jackwalkerlabs:fix/non-utf8-subprocess-output
Sep 14, 2026
Merged

henryiii merged 2 commits into
pypa:mainfrom
jackwalkerlabs:fix/non-utf8-subprocess-output

Conversation

@jackwalkerlabs

@jackwalkerlabs jackwalkerlabs commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

A build tool emitting non-UTF-8 bytes replaces its actual exit error with UnicodeDecodeError. In verbose mode the same decoding failure can abort a successful tool invocation. Decode diagnostics with backslashreplace in both captured and streamed output so the original byte is visible and the subprocess exit status is preserved.

Three regressions run real Python subprocesses emitting byte 0xff, covering failed commands in quiet and verbose modes and successful verbose output. All fail before the change. Validation: 304 tests plus 5 subtests pass (47 platform/integration skips), Pyrefly reports zero errors and 100% public type coverage, and all changed-file pre-commit checks pass.

Implemented and locally validated with OpenAI Codex.

Issue tracking: Found during source inspection; no matching open issue was identified for this fix.

@henryiii henryiii changed the title Preserve subprocess results with non-UTF-8 output fix: preserve subprocess results with non-UTF-8 output Sep 14, 2026
@henryiii
henryiii merged commit 45d4aab into pypa:main Sep 14, 2026
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants